<%= javascript_include_tag "prototype" %>

<div id="show_five_comments" align="left" style="padding-top:25px;width:500px">
  <% if @comments %>
  <div style="padding-bottom:5px"><h3>Comments:</h3></div>
    <% for comment in @comments %>
    <div style="background-color:grey;color:white">
      <span style="font-weight:bold"><%=h comment.user.login %></span> wrote on 
      <%= comment.created_at.strftime("%m-%d-%Y") %> at 
      <%= comment.created_at.strftime("%I:%M %p") %>
      <div>
      (<% if current_user %>
      <% if (current_user.id == comment.user_id || current_user.id == @webcomic.creator_id) %>
        <%= link_to_remote 'Edit', :update => "comment_form",
             :url => {:action => :edit_comment, :strip_id => @displayed_strip.id, :id => params[:id], :comment_id => comment.id} %> | 
        <%= link_to_remote 'Delete',:url => {:action => :delete_comment, :strip_id => @displayed_strip.id, :id => params[:id], :comment_id => comment.id}, :confirm => 'Are you sure?' %>|
      <% end %>
      <% end %>
      <%=h comment.commentrating %>
      <% if current_user %>
        <%= link_to_remote(image_tag("starminus.png", :border=>"0",:size => "13x13", :alt => "-1", :mouseover => "-1"), 
            :url => {:action => :comment_rating, :r_value => -1 + comment.commentrating, :strip_id => @displayed_strip.id, :comment_id => comment.id, :id => params[:id]}) %>
        <%= link_to_remote(image_tag("starplus.png", :border=>"0",:size => "13x13", :alt => "+1", :mouseover => "+1"), 
            :url => {:action => :comment_rating, :r_value => 1 + comment.commentrating, :strip_id => @displayed_strip.id, :comment_id => comment.id, :id => params[:id]}) %>
      <% end%>):
     </div>
    </div>
    <div style="padding-bottom:14px"><%=h comment.contents %></div>
    <% end %>
<div style="padding-top:20px">
<table width="500">
  <tr>
    <td width="15%">
      <% if @pn_comments[:previous] %>
      <%= link_to_remote( "<< Prev 5",
      :url => { :action => :show_previous_comment, :strip_id => @displayed_strip.id, :id => params[:id]} ) %>
      <% end %>
    </td>
    <td width="15%">
      <% if @displayed_strip && @num_of_comments > 5 %>
      <%= link_to_remote("View All Comments (" + @num_of_comments.to_s + ")",
      :url => { :action => :show_all_comments, :strip_id => @displayed_strip.id, :id => params[:id] } )%>
      <% end %>
    </td>
    <td width="15%">
      <% if @pn_comments[:next] %>
      <%= link_to_remote( "Next 5 >>",
      :url => { :action => :show_next_comment, :strip_id => @displayed_strip.id, :id => params[:id]}) %>
      <% end %>
    </td>
  </tr>
</table>

<div style="padding-top:20px">
<% if !current_user %>
<a href="javascript:setFocusLogin()">Please Login to Comment</a>

<script>
function setFocusLogin() {
	document.getElementById('login').focus();
}
</script>
<% else %>
<div id="comment_form">
<%= render :partial => "comment_new_form" %>
</div>
<% end %>
</div>
</div>








<% end %>
</div>
